package com.yanqu.road.server.cmd.activity.seacraftsouthsea;

import com.yanqu.road.pb.activity.SeacraftSouthSeaProto;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.seacraftsouthsea.SeacraftSouthSeaMgr;
import com.yanqu.road.server.manager.activity.seacraftsouthsea.SeacraftSouthSeaUnionInfo;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

import java.util.List;

/**
 * @Description
 * @Author cwq
 * @Data 2022/2/12 14:20
 */
@Cmd(code = CrossProtocol.C2_SEACRAFT_SOUTH_SEA_SYN_PROMOTION_UNION, desc = "海上争霸 南海丝路 同步晋级的联盟数据")
public class CrossSeacraftSouthSynPromotionUnionCmd extends CrossUnionCommand  {

    int activityId;
    List<SeacraftSouthSeaProto.SeacraftSouthSeaUnionInfo> unionInfoList;
    List<SeacraftSouthSeaProto.SeacraftSouthSeaLockUserInfo> userTeamInfoList;
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        SeacraftSouthSeaProto.SeacraftSouthSeaSynPromotionUnionGameToCrossMsg builder = SeacraftSouthSeaProto.SeacraftSouthSeaSynPromotionUnionGameToCrossMsg.parseFrom(packet.getBytes());
        activityId = builder.getActivityId();
        unionInfoList = builder.getUnionListList();
        userTeamInfoList = builder.getUserTeamInfoListList();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        SeacraftSouthSeaMgr.synPromotionUnion(activityId, groupId, unionInfoList,userTeamInfoList);
    }

    @Override
    public void sendData() {

    }
}
